(**************************************************************************)
(*       ___                                                              *)
(*      ||M||                                                             *)
(*      ||A||       A project by Andrea Asperti                           *)
(*      ||T||                                                             *)
(*      ||I||       Developers:                                           *)
(*      ||T||         The HELM team.                                      *)
(*      ||A||         http://helm.cs.unibo.it                             *)
(*      \   /                                                             *)
(*       \ /        This file is distributed under the terms of the       *)
(*        v         GNU General Public License Version 2                  *)
(*                                                                        *)
(**************************************************************************)
include "basics/lists/list.ma".
include "arithmetics/nat.ma".


inductive s : Type[0] ≝
| atom : s
| node : list s → s.


let rec length_s (ls:list s) on ls ≝
match ls with [
  nil ⇒ 0
| cons hd tl ⇒ length_s tl + (match hd with [
                atom ⇒ 1
              | node subl ⇒ length_s subl
              ])
].

